/***************************************************************
 * Name:      rdesktopsApp.cpp
 * Purpose:   Code for Application Class
 * Author:    Steven Lee (steven.tc.lee@gmail.com)
 * Created:   2009-07-10
 * Copyright: Steven Lee (http://code.google.com/p/rdesktops/)
 * License:
 **************************************************************/

#include "rdesktopsApp.h"

//(*AppHeaders
#include "rdesktopsMain.h"
#include <wx/image.h>
//*)

#include "rdesktopsTaskBarIcon.h"


IMPLEMENT_APP(rdesktopsApp);

bool rdesktopsApp::OnInit()
{
    const wxString name = wxString::Format( L".rdesktops-%s.lck", wxGetUserId().c_str() );
    wxSingleInstanceChecker* singleInstanceChecker = new wxSingleInstanceChecker(name);
    if ( singleInstanceChecker->IsAnotherRunning() )
    {
        return false;
    }

    //(*AppInitialize
    bool wxsOK = true;
    wxInitAllImageHandlers();
    if ( wxsOK )
    {
    	rdesktopsFrame* Frame = new rdesktopsFrame(0);
    	Frame->setSingleInstanceChecker(singleInstanceChecker);
        Frame->setTaskBarIcon( new RDesktopsTaskBarIcon(Frame) );
    	Frame->Show();
    	SetTopWindow(Frame);
    }
    //*)

    return wxsOK;
}
